Fixing several mistakes introduced from the last commit