Fixed gmath errors and warnings