Fixing bugs in alert rules and functions based on review.