Remove compiler warnings.

 * Removed compiler warnings for util.
 * Fixed some errors (null pointer dereference).