more unit test cases and bug fixes for chunkparser. add templates.py