Made error handling when executing SSH commands more flexible