Temporary fix using dynamic_cast