Fix multi-instance bug