Apply various bugfixes for shell command functions