Fix for commands sent through the API

Fix for bug https://dev.icinga.org/issues/5465