fix warnings, add toBCD function