Install fix

This should fix #259.

A couple of notes:
- To enable better error handling `/bin/sh` was changed to `/bin/bash`
- A trap handler should catch all errors
- Some whitespace-related issues were resolved.