Added an error-handler.
Fixed typos
Added errorhandling