Fix incompatible pointer errors and additional const errors.