Some code corrections