fixed working with multiple instances