Fix errors made in the previous fix. Resolved image quality bug.