removed typo; tightened up number check