Removed writing 0 on exit