fixed type casting problems