fixed empty() checking