added some error handeling
added some error handeling
added some error handeling