fixed rmagic