added real error handeling