Fixed invalid type cast.