add logging and multiple instances dection