1. sanitize output_dir 2. add unit tests for customized output_dir