make is_empty implementation shorter