Fixes the up() and down() functions (but not yet left() and right()).