Query fixes for notification settings page

When opening up notification settings these 2 queries failed raising an exception. This fixes the notifications settings page. This should fix issue #305