fixed casting problem