Defensive coding. Fixes #15.