added phantom exit on error