fix cast exception