error handeling fixed