fixed a layout bug adhoc-ly, a bug in lookup_color(), a bug in layout traversal