count sum and error have bug