added error checking to ip to string conversion