Fixed typecast

suggested by jmaebe