fixed casting error