fixed semicolon compile errors and index reference