Fixed some type conversion issues