improved row handling