do not rely on global variables; add check for existing values before using them in sql call
Merge commit 'github/testing' into beta