fixed typecast problem