Removed useless code
Fixed type conversion