throw expected exceptions
added some logging