Fixed off-by-one error

This bug caused the handler of last alert action to be ignored.