Some bugs fixed here and there