improve and fix tests