Various error fixes