Fixed bugs introduced by the previous commit