isEmpty() is returning false even when "empty", causing assertion error