fixed some bugs since last major revision