fixed a typecast error