fix percent function