Added first round of fixes suggested by @cloudef at https://lists.stacken.kth.se/mailman/private/glfw-dev/2013-October/000821.html