Fixes removal of nulls in loops