Fixed some bugs related to flash_message handling.