Fix bug with running script from other location than bin

Also added support for detecting environment var OPENESP_HOME