Fix bugs introduced by merge