fixed several problems