fixed build logic for correct exit, message output