fixed a bad cast