Check variable presence correctly, and split strings safely.

Fixes tests.