adding terminate/1 to handler