Replace some size calls when checking for emptiness