handled more error cases