Do you have to use localhost for any particular reason? The easiest fix for this will be to make those functions work correctly by putting a real hostname or ip address into the site address field in WordPress settings. Look in Settings > General Settings.