Changes to sprite flipping, closes #659