bug fixed, test passes