merged latest fixes from lib:rewired
Exit with code 1 on error