fixed and running tested on win and linux