Fixed javascript errors/warnings