fixed error handling closes #173 closes  #165