Handle constructor aliases better for commonjs modules. Fixes issue 1244