Fix several bugs with datauri