Fix spl_directory cast_object, reenable error