Fix some issues with binary patching system