working but returned the wrong period