fixed typo in comment
removed unnecessary casts
reintroduced unnecessary casts