fix a bug of pointer cast