applied patch
improving tests
small fixes