Several fixes / optimizations for acl