Improved error handling

Signed-off-by: Cory Feitelson <cfeitelson@roovy.com>