Add to_dict method, fix missing method