Tests, bugfixes.

Travis issue is not fixed, so [ci skip]