Fixed some bugs when removing empty shape files