added a better way to handle arrow-key presses when data is null