Minor code error fixes