Remove log and fix bug with calculation by categories