fixed throwing exceptions in magic methods

fixed throwing exceptions in magic methods