added handling of empty/undefined commands