jumping to bootloader

I’m trying to reboot an Arduino mini from within the running program. I found this on the web:

sei();
MCUCR |= _BV(IVSEL);
asm volatile ("\tjmp 0x1C00\n");

But it doesn’t work reliably. Sometimes it reboots and I can download a new program, or watch the program restart, and sometimes it goes into the weeds and the bootloader never responds to downloading, and the existing program never starts up even when I don’t attempt to download anything.

I need this functionality because the mini is going to be built into a small container that for practical and aesthetic reasons I won’t have access to the reset switch. I will have serial communications, however. Any advice?

On the Mini, the bootloader starts at 0x3800 since there are 16 KB of Flash. (The 0x1C00 looks like it's for the ATmega8, which has 8 KB.)

Ha, no wonder it was unpredictable. It was jumping into my code and if I was LUCKY it would crash and reset. I knew this. Thanks, sometimes it just takes a second pair of eyes.