fixes nil attribute issue