avoid the stack-smasher strcpy-alloca and minor cleanup