Fixed issue in pdfman script and added lw function.