add state checking for reentrant processes