fixed issue and tests