fixed R killing itself bug