patches for several mistakes here