minor fixes; tests improvements