fixed matching braces, added unittest