Fixed bug that gave bad period numbers