cleans up key binding function
fixes some bugs that appears during deployment, but not locally, for some reason