Bug fixes, merge error fixes