added some thread safety and fixed world/channel order