Remove warnings and potentianl null access