fixing on-completion bug