Freeing barrier before exiting, fixing initialization