Variousu bug fixes