Fixed bug with cost propagation for multi-level encodings