Fix dereferencing of type-punned pointer

Fixes #897