more utility functions

also changed default type of hostname, so stored as null in db if not
needed and made requested ip actually store the requested ip address