fix more emptiness checks 

Fix more emptiness checks. Use empty() instead of checking against size().