Fix out-of-bounds alert and only show it once

This pull request: 

1) Fixes the out-of-bounds alert (context is never defined)
2) Prevents repeated out-of-bounds notifications
3) Adds some missing semicolons