Added nicer handling of filesystem errors

Signed-off-by: Ozan Turgut <ozanturgut@gmail.com>