Fix some bugs in brace.py - still not perfect