removed unnecessary conditional, removed commented debug code, replaced debug check with assert