Some warning fixes and error fixes