Fixed encoding errors, and no more math errors