syntax issues and undefined variable checking