replaced unsafe method