Fix bugs when receiving notifications