Multiple fixes related to pending_op cleanup