fix dir emptiness check in export
adding test cases