modify process lock and exit logic