code with wifi errors fixed