fix auto-fork detection. Fixes #501