FIXED some encoding bugs