Fixed some bad casting and unused imports