Fix typo, var names and TypeError