Fixed bug when connecting not from localhost