Fix script to catch interrupt signal