Minor bugs fixes