Note: possible minor security issues fixed (untrusted string used as printf format string). Approved by: philip (mentor)