added errorlogging
.