fix for variable retrieval from database