Fixed validation bugs from Issue #2 and #3