handle errors and added default generator