adding safe exit to client