Revert "Invalid pointer fix and getClass fix"

This reverts commit d929476bee721e295f7e73d7395e29ca090c122b.