fixed exception while casting