Replaced get_class() calls with instanceof operators

This PR replaces get_class() calls with instanceof operators.

Fixes #570.