Better handling of #d%