added check to mods variable to make sure it is set before calling method on it