fixes from Gil
fix encoding