Use valid pointerId and assert function, fixes #1269