changed code sequence for lib.pm correctly load