Prevent loaded event from being called multiple times, fixes #237