fix bug in TPNumber, add tests