[pergola] write() now checks the type of input object