Fixing is_valid to detect empty strings

Closes #6.