Fix #7 writing data as Buffer instead of throwing Unknown type error