Fixed a bug that caused a 500 error when sorting images where an image had a position of nil.