fixed js error when not having chat messages in database