bugfixing last call and connection closing