add coverage and fix tests