Fixed bug that caused an error message to be supressed
Added DatabaseReference, tweaked some logging issues