osx improvements

Additions for error handling and debugging purposes. Modifications to
make the script function better on slow serial-usb connections.