fix bad cast