Fixed scope_for_rebuild, NULL values cannot be compared with SQL = operator

Scope columns can contain NULL values. This commit fixes regression introduced in version 3.