Issue 2. Fixed NPE for missing directory.