fixing bugs introduced by initial commit.