Correct multiple bugs