fix for double counting other minor improvments