Added a check to prevent from serving dot-files
Merged in the try-catch block