Made release method more robust