fixed bugs in fork check