Fix a few crashbugs preventing running the mod on server