Add bug monitor code