improved  handling in the library