Fixed issues found in pull request

Trim not working and Javascript error due to typos