Adding specificity to the `'undefined'` string check and some unit tests would help cleaning the code, which is always a good thing.

I think it can be a good first bug for you, but Gaia will still work if you prefer to work on another bug.