fix to accept cancel buttons