Better checks for library metadata

See #1765