refactored getLocalIP; called join() before forking the new thread