Bugfixes and improvements here and there