Fix order of library dependencies