added defensive check for test size