Fix test mode to work with all table sizes