You can get lumpy custard if you don’t temper the egg properly or if you overcook the custard. To prevent lumpy custard you need to pour the milk into the egg mixture very slowly while whisking constantly and you need to cook the custard on a low temperature while also whisking constantly and make sure it does not start to boil.