Fix bug where spacebar refreshed page