Bug fix and reshuffling some variables initialisations