spurious 'undefined' removed from generated code