fixed a potential ClassCastError