Fix error handling, also migrate to go1.3