Fixed syntax error and reference error