Placing safeguards for files

Signed-off-by: Kasper Grubbe <kawsper@gmail.com>