Improve tests. Minor bugfix