Fix bug in email address validation

Tweaked existing validation code as it wasn't working as expected.

Closes #156