Added back type-casting trick from sgravrockdf via pivotal issue #191