Handle unset HOME environment variable more gracefully