fixed casting exception