made hemlib more general, so that it can handle multiple working dirs