Merged library changes and compile fixes