Fix #18 for attributes document frequencies
add tests for Fix #18