Surely that's a timing bug right there...
Correct. From most applications an sei / sleep_mode sequence is a timing related bug (a "race condition").
The code snippets in the Libc documentation show the correct way to put the processor to sleep (sei immediately followed by sleep_cpu)...
http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html
I'm not sure what the process is for writing these libraries that come included...
Which libraries?