Amend sorting logic

Need to amend sorting logic as it will default to 0 and therefore break if you want to override it.