bugfix: isValid helper was always returning false