Not registering listeners if the file does not exists

Solves the problem of writing to a non-existent file when you create a class.