improve memory management for command binding