Bugfix var name in sql