ensure bed is sorted