Fix attachment ordering with negative values

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