fixed bugs introduced by bad merges