changes nulls to on.exit for better failing security