fixed encoding and added back missing stuff
mm