Fixed small bugs and warnings