Use when instead of if
Check current node exists in shm/: (fixes #21)