Better handling for invalid ranks