Need a cast here to suppress warning - why do we need this function?