updated code to catch SignalException