Code fix

Fixed scope issue, and missing semicolons.