Fix library build order
Fix library dependencies