Another typecast bugfix from John Fay