Fix libraries order in build