Move empty dir check up.