ip address bug fix
big fix and error handling