some fixes in terms of map

Mainly, make a intermediate function to get the keys we want. 
I think the issue is more that this branch isn't currently kompiling with the java backend, so these sorts of syntactic errors are slipping through, but I would think we should be able to keep it kompiling with the maude backend (on unified-builtins) so we could still be checking for these errors. But I could be wrong.