Fixed several bugs that appeared when running app as GAE web app