fixing code to work on server