fixed some bugs causing errors in firefox
Merge branch 'master' into dev