fixed syntax errors and isset() calls on results