Fix issue 58 and pull request 76

use match instead of repr