fix bugs calculate