Fix bugs and compile errors after merging branches.