Changed worklog queries for extended database compatibility and performance improvement

fixed