fix if the last 5 values of a variable is null when checking the database

also fix for not adding nulls if the application is restarted when a site is offline