bug fixed, values compute correctly