add checks for affected_rows values  bug565