some changes to make plugin work on win and unix