build script: fix error handler