added is_array check to see if rows > 0