optimize library loading