- Quote command substitution to prevent globbing etc
- Add missing error handling