Replaced stopping and starting interrupts in functions with locks