extended test coverage, few other fixes