Fixes type conversion issues, as well as spelling mistake of function