modified ptlsm.c