Added a little mor eerror handling