fixed bug for typecast.