Fixed shutdown behaviour and added print expression