Added chptr and fixed a bug.