Fixed bad cast