Fix bugs and jshinted