Use integers (not strings) to sort attachments

Fixes https://www.pivotaltracker.com/story/show/61889412