fixed cal bug