Re-add empty flag checking