Fixed typecasting issue