Restructured tests and fixed a str/unicode issue