Fix for flash messages
Added tests and a sleep :(