Fix 500 if a file is treated as a path

Fix #250