Removed exit 0 and modified script not to rely on /proc so that it works also on OSX