Fixed type casting issue