Fix test function and remove unneeded lines.