Small refinements and 1 bugfix