Fix various custom attribute encoding bugs.
Version 0.2.1