Fix "Warning: get_class() expects parameter 1 to be object..." error