fix minor remarks
fix redundant debug log
proper exitcode handling