Before destroy check and various fixes