Fix problem with datatype of returned value