fixed type punning and gcc warning