add class_exists check

fixes #16