merge: small leakfix and code simplification