Improve code to get library file name