Fixed problem with resources that cause NullPointerException error