Fixed typecasting to object at another place