Fixed some pointer-type bugs