Fixed bug in decode()