fixing init script. adding envvar support