Fixed errors with flash messages