fix bugs in winphone code gen