Runs without error, but results are wrong