in reply to array bug?

I'm not sure why you think this is a bug, as you do not say. It appears to be working correctly to me; perhaps the piece of information that you lack is that sort by default sorts things as strings, which you could discover by reading the documentation for sort. If you want to sort numerically, you can supply your own function or block to do it.