fixed code to work with remote server