Added correct error handling.
0.3.1