fix several problems