Adding an is_dir check on the state folder in the controller.