fix bug of exceeding 50 pins