fixed bug on multiple instances