refactor setNull to avoid using a static variable