Small error fix. Overall, it seems to work, need to run more tests to make sure.