Some library handling improvements