fixed bug with Code property and added tests.