Correct BoxCount calculation