Fixed "pure virtual method called" error, and "dereferencing type-punned...

... pointer" warning