fixed bad cast