Added missing :endxxx for TOPLEVEL
Fixed uninitialized variable error
cosmetic change