added extra invariants and invalid chars tests