Fixed bugs introduced by merge