added better handling of missing library, thanks Michele