Fixed #6, handled exception.

Also removed some deprecation warnings.