Tidied fix for id attributes that cause a segfault

fixes #151