added cast check
forgot to set prepared