Better errors and library checks for tests