more setup to before endinit rather than after the loaded event