Fixing casting issue